#ifndef BYTEBUFFER_H_
#define BYTEBUFFER_H_

#include <stddef.h>

/*
 * byte buffer
 */
class ByteBuffer {
public:
	ByteBuffer();
	ByteBuffer(size_t init_size);
	virtual ~ByteBuffer();

	const char* get() {
		return _buffer;
	}
	size_t length() {
		return (_buffer != NULL ? _length : 0);
	}
	size_t size() {
		return (_buffer != NULL ? _size : 0);
	}

	size_t append(char* data, size_t size);

	void resize(size_t newsize);
	void clear();

protected:
	size_t _size;
	size_t _length;
	char* _buffer;
};

#endif /* BYTEBUFFER_H_ */
